package com.dapeis.core.utils.json;

import java.lang.reflect.Type;

import com.dapeis.core.utils.DBConfigUtils;
import com.dapeis.domain.CosFile;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class CosFileGsonAdapter implements JsonSerializer<CosFile> {

    @Override
    public JsonElement serialize(CosFile src, Type typeOfSrc,
	    JsonSerializationContext context) {
	JsonObject json = new JsonObject();
	json.addProperty("id", src.getId().toString());
	json.addProperty("imgPath", DBConfigUtils.getFullImgPath(src.getPath()));
	return json;
    }

}
